from bs4 import BeautifulSoup
import html2text as ht
import requests


headers = {
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
    'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
}

keyword = "小舍得"
url = 'https://www.baidu.com/s?wd=' + keyword + '&ie=utf-8'

u = "https://movie.douban.com/subject/30170907"
t = requests.get(url = u, headers = headers) # 请求网址
# t.encoding='utf-8'
# print(t.encoding)
soup = BeautifulSoup(t.text, 'html.parser')   #文档对象
print(t.text)
# lt = soup.find_all('span', class_='short')
# for item in lt:
#     print(item)
